package com.example.amusic.service

import androidx.annotation.StringRes
import com.example.amusic.R

sealed class PlayMode(val value: Int, @StringRes val nameRes: Int) {
    data object Loop : PlayMode(0, R.string.play_mode_loop)
    data object Shuffle : PlayMode(1, R.string.play_mode_shuffle)
    data object Single : PlayMode(2, R.string.play_mode_single)

    companion object {
        fun valueOf(value: Int): PlayMode {
            return when (value) {
                0 -> Loop
                1 -> Shuffle
                2 -> Single
                else -> {
                    Loop
                }
            }
        }
    }
}